import 'package:healthy_station_flutter/generated/json/base/json_convert_content.dart';
import 'package:healthy_station_flutter/entity/pre_info_entity.dart';

PreInfoEntity $PreInfoEntityFromJson(Map<String, dynamic> json) {
  final PreInfoEntity preInfoEntity = PreInfoEntity();
  final String? billId = jsonConvert.convert<String>(json['billId']);
  if (billId != null) {
    preInfoEntity.billId = billId;
  }
  final String? billType = jsonConvert.convert<String>(json['billType']);
  if (billType != null) {
    preInfoEntity.billType = billType;
  }
  final String? medId = jsonConvert.convert<String>(json['medId']);
  if (medId != null) {
    preInfoEntity.medId = medId;
  }
  final String? medName = jsonConvert.convert<String>(json['medName']);
  if (medName != null) {
    preInfoEntity.medName = medName;
  }
  final String? medSpec = jsonConvert.convert<String>(json['medSpec']);
  if (medSpec != null) {
    preInfoEntity.medSpec = medSpec;
  }
  final String? price = jsonConvert.convert<String>(json['price']);
  if (price != null) {
    preInfoEntity.price = price;
  }
  final String? num = jsonConvert.convert<String>(json['num']);
  if (num != null) {
    preInfoEntity.num = num;
  }
  final String? unit = jsonConvert.convert<String>(json['unit']);
  if (unit != null) {
    preInfoEntity.unit = unit;
  }
  final String? amount = jsonConvert.convert<String>(json['amount']);
  if (amount != null) {
    preInfoEntity.amount = amount;
  }
  final String? drugWay = jsonConvert.convert<String>(json['drugWay']);
  if (drugWay != null) {
    preInfoEntity.drugWay = drugWay;
  }
  final String? usage = jsonConvert.convert<String>(json['usage']);
  if (usage != null) {
    preInfoEntity.usage = usage;
  }
  final String? dosage = jsonConvert.convert<String>(json['dosage']);
  if (dosage != null) {
    preInfoEntity.dosage = dosage;
  }
  final String? dosageUnit = jsonConvert.convert<String>(json['dosageUnit']);
  if (dosageUnit != null) {
    preInfoEntity.dosageUnit = dosageUnit;
  }
  final String? demand = jsonConvert.convert<String>(json['demand']);
  if (demand != null) {
    preInfoEntity.demand = demand;
  }
  final String? submitDate = jsonConvert.convert<String>(json['submitDate']);
  if (submitDate != null) {
    preInfoEntity.submitDate = submitDate;
  }
  return preInfoEntity;
}

Map<String, dynamic> $PreInfoEntityToJson(PreInfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['billId'] = entity.billId;
  data['billType'] = entity.billType;
  data['medId'] = entity.medId;
  data['medName'] = entity.medName;
  data['medSpec'] = entity.medSpec;
  data['price'] = entity.price;
  data['num'] = entity.num;
  data['unit'] = entity.unit;
  data['amount'] = entity.amount;
  data['drugWay'] = entity.drugWay;
  data['usage'] = entity.usage;
  data['dosage'] = entity.dosage;
  data['dosageUnit'] = entity.dosageUnit;
  data['demand'] = entity.demand;
  data['submitDate'] = entity.submitDate;
  return data;
}

extension PreInfoEntityExtension on PreInfoEntity {
  PreInfoEntity copyWith({
    String? billId,
    String? billType,
    String? medId,
    String? medName,
    String? medSpec,
    String? price,
    String? num,
    String? unit,
    String? amount,
    String? drugWay,
    String? usage,
    String? dosage,
    String? dosageUnit,
    String? demand,
    String? submitDate,
  }) {
    return PreInfoEntity()
      ..billId = billId ?? this.billId
      ..billType = billType ?? this.billType
      ..medId = medId ?? this.medId
      ..medName = medName ?? this.medName
      ..medSpec = medSpec ?? this.medSpec
      ..price = price ?? this.price
      ..num = num ?? this.num
      ..unit = unit ?? this.unit
      ..amount = amount ?? this.amount
      ..drugWay = drugWay ?? this.drugWay
      ..usage = usage ?? this.usage
      ..dosage = dosage ?? this.dosage
      ..dosageUnit = dosageUnit ?? this.dosageUnit
      ..demand = demand ?? this.demand
      ..submitDate = submitDate ?? this.submitDate;
  }
}